package static_;

/**
 * @author wly
 * @create 2022-11-26 14:20
 */
public class ChildGame {

    public static void main(String[] args) {

        Child c1 = new Child("白骨精");
        Child c2 = new Child("蜘蛛精");
        System.out.println("静态变量的初始值（int）为 = " + c1.count);
        c1.join();
        c2.join();
        System.out.println("此时的count值 = " + Child.count);
    }
}

class Child{  //类
    private String name;
    public static int count;

    public Child(String name) {
        this.name = name;
    }

    public void join(){
        System.out.println("小朋友 " + this.name + " 加入游戏!");
        count++;
    }
}
